<template>
    <div v-if="Number.isInteger(d.num)">
        {{ d.num.toFixed(0) }}
    </div>
    <div v-else>
        {{ d.num.toFixed(2) }}
    </div>
</template>

<script setup>
import { reactive, watch } from 'vue';
import gsap from 'gsap';
import { type } from 'windicss/utils';


const props = defineProps({
    value: {
        type: Number,
        default:0
    }
})


const d = reactive({
    num : 0
})

function AnimateToValue(){
    gsap.to(d, {
        duration:0.5,
        num: props.value
    })
}

AnimateToValue()

watch(()=>props.value, ()=>AnimateToValue())

</script>

